
import shotgun_api3

def get_asset_published_file(asset_id, publish_type):
    """
    get_asset_published_files(asset_id=2201, publish_type="Shader Mapping")
    args:
        asset_id: 
        publish_type: 
    retrun: list.  e.g.
    [
    {'id': 6445,
    'path': {'content_type': None,
           'id': 62784,
           'link_type': 'local',
           'local_path': 'X:\\thingdom\\assets\\character\\shaderMappingTest\\shaders\\shaderMappingTest.Shading.v004.yml',
           'local_path_linux': '/nas/Library/3dassets/thingdom/assets/character/shaderMappingTest/shaders/shaderMappingTest.Shading.v004.yml',
           'local_path_mac': '/nas/Library/3dassets/thingdom/assets/character/shaderMappingTest/shaders/shaderMappingTest.Shading.v004.yml',
           'local_path_windows': 'X:\\thingdom\\assets\\character\\shaderMappingTest\\shaders\\shaderMappingTest.Shading.v004.yml',
           'local_storage': {'id': 3,
                             'name': '3dassetRoot',
                             'type': 'LocalStorage'},
           'name': 'shaderMappingTest.Shading.v004.yml',
           'type': 'Attachment',
           'url': 'file://X:\\thingdom\\assets\\character\\shaderMappingTest\\shaders\\shaderMappingTest.Shading.v004.yml'},
    'type': 'PublishedFile',
    'version_number': 4},

    ......
    
    ] 
    
    """

    sg = shotgun_api3.Shotgun("http://shotgun-staging.3dbox.com",
                              login='shenmeng',
                              password='sheen@3dbox.com')
    filters = [
        ["entity", "is", {"id":asset_id, 'type': 'Asset'}],
        #["name", "is", "shaderMappingTest"],
        ["published_file_type", "name_is", publish_type], 
    ]

    fields = ["version_number", "path"]
    data = sg.find('PublishedFile', filters, fields)
    return data
